#include <stdio.h>

int atoi(char in[]);
int actualatoi(char[] , int , int );


int main ()
{
  printf("%d",atoi("1238943"));
  return 0;
}

int atoi(char in[])
{
  return actualatoi(in,0,0);
}

/* convert an integer into a string by calling a recursive routine. */
int actualatoi(char in[], int pos, int current)
{
  if (in == 0) return 0;
  if (in[pos] == '\0') return 0;
  else
    {   // if the size of the input character is at least one.
	 if (in[pos+1] == '\0') return 10*current+in[pos]-'0'; //if the size IS one
	 else  //we have to handle further decimals here.
	   {
		return actualatoi(in,pos+1,10*current+in[pos]-'0'); //the next digit
	   }
    }
}
